package day04;

import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebInitParam;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet(value = "/config",initParams = {
        @WebInitParam(name = "a",value = "1"),
        @WebInitParam(name = "b",value = "2")
})
public class ServletConfigServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("ServletConfigServlet.service()");


        ServletConfig config=getServletConfig();

        String a=config.getInitParameter("a");
        String b=config.getInitParameter("b");

        System.out.println("a = " + a);
        System.out.println("b = " + b);


    }

}
